package cn.iocoder.yudao.module.alipay.dal.mysql.babyordername;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.babyordername.BabyOrderNameDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.app.babyordername.vo.*;

/**
 * 宝宝起名订单名称关联 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BabyOrderNameMapper extends BaseMapperX<BabyOrderNameDO> {

    default PageResult<BabyOrderNameDO> selectPage(AppBabyOrderNamePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BabyOrderNameDO>()
                .eqIfPresent(BabyOrderNameDO::getOutTradeNo, reqVO.getOutTradeNo())
                .eqIfPresent(BabyOrderNameDO::getTradeNo, reqVO.getTradeNo())
                .eqIfPresent(BabyOrderNameDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BabyOrderNameDO::getNames, reqVO.getNames())
                .betweenIfPresent(BabyOrderNameDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BabyOrderNameDO::getId));
    }

    default List<BabyOrderNameDO> selectList(AppBabyOrderNameExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BabyOrderNameDO>()
                .eqIfPresent(BabyOrderNameDO::getOutTradeNo, reqVO.getOutTradeNo())
                .eqIfPresent(BabyOrderNameDO::getTradeNo, reqVO.getTradeNo())
                .eqIfPresent(BabyOrderNameDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BabyOrderNameDO::getNames, reqVO.getNames())
                .betweenIfPresent(BabyOrderNameDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BabyOrderNameDO::getId));
    }

    default  BabyOrderNameDO selectByTradeNo(String tradeNo) {
        return selectOne(new LambdaQueryWrapperX<BabyOrderNameDO>().eq(BabyOrderNameDO::getTradeNo, tradeNo));
    }

}
